package com.three.Service.ServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.three.Mapper.StudentMapper;
import com.three.Pojo.Student;
import com.three.Service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements IStudentService {
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public void addsave(Student student) {
        studentMapper.addsave(student);
    }

    @Override
    public PageInfo<Student> findlist(Integer pageNum, Integer pageSize, String stuName) {
        PageHelper.startPage(pageNum,pageSize);
        List<Student> list=studentMapper.findstudentlist(stuName);
        PageInfo<Student> pageInfo= new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public Student findByid(Integer id) {
        return studentMapper.findByid(id);
    }

    @Override
    public void updatesave(Student student) {
        studentMapper.updatesave(student);
    }

    @Override
    public void delete(Integer id) {
        studentMapper.delete(id);
    }
}
